// package cn.ayanami.blog.config;

// import org.springframework.context.annotation.Bean;
// import org.springframework.context.annotation.Configuration;
// import org.springframework.data.r2dbc.config.AbstractR2dbcConfiguration;
// import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
// import org.springframework.data.r2dbc.repository.config.EnableR2dbcRepositories;

// import cn.ayanami.blog.entity.po.ArticlePo;
// import io.r2dbc.spi.ConnectionFactories;
// import io.r2dbc.spi.ConnectionFactory;
// import io.r2dbc.spi.ConnectionFactoryOptions;

// @Configuration
// @EnableR2dbcRepositories
// public class H2DBConfig extends AbstractR2dbcConfiguration{

//   @Override
//   @Bean
//   public ConnectionFactory connectionFactory() {
//       System.out.println("=====================init DB");
//     ConnectionFactoryOptions options =ConnectionFactoryOptions.builder()
//     .option(ConnectionFactoryOptions.DRIVER, "h2")
//     .option(ConnectionFactoryOptions.PROTOCOL, "tcp")  // file, mem
//     .option(ConnectionFactoryOptions.HOST, "localhost")
//     .option(ConnectionFactoryOptions.PORT, 8082)
//     .option(ConnectionFactoryOptions.USER, "sa")
//     .option(ConnectionFactoryOptions.PASSWORD, "123456")
//     .option(ConnectionFactoryOptions.DATABASE, "moonlight_blog")
//     .build();
//     // ConnectionFactory connectionFactory = ConnectionFactories.get("r2dbc:h2:tcp://127.0.0.1:8082/moonlight_blog?options=DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE");
//     ConnectionFactory connectionFactory = ConnectionFactories.get(options);
//     R2dbcEntityTemplate template = new R2dbcEntityTemplate(connectionFactory);

//     var ls = template.select(ArticlePo.class).first().subscribe(e->{System.out.println(e.getArticleHtml());});
//     return  connectionFactory;
//   }
// }
